/**
 * Copyright (c) 2008, Keisuke Inoue, Syracuse Unviersity
 * All rights reserved.
 *
 */
package edu.syr.iis.web.controller;

import java.util.List;

import edu.syr.iis.web.model.Dataset;
import edu.syr.iis.web.model.DatasetManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 * @author kinoue
 *
 */
public class DatasetListController  extends AbstractController // implements Controller
{
    DatasetManager datasetManager;
    public static final String MAP_KEY = "datasets";
    private String successView;
        
    @Override
	public ModelAndView handleRequestInternal(HttpServletRequest arg0,
	    HttpServletResponse arg1) throws Exception
    {
	List<Dataset> datasets = datasetManager.getDatasets();	
        return new ModelAndView(getSuccessView(), MAP_KEY, datasets);
    }

    public DatasetManager getDatasetMaager()
    {
        return datasetManager;
    }

    public void setDatasetManager(DatasetManager datasetManager)
    {
        this.datasetManager = datasetManager;
    }

    public String getSuccessView()
    {
        return successView;
    }

    public void setSuccessView(String successView)
    {
        this.successView = successView;
    }
    
    

}
